<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>05pcvaluetransferwork2</title>
    <script type="text/javascript" src="../js/vue.js"></script>
    <style>
        .mydiv {
            padding-left: 30px;
        }

        .div1 {
            width: 900px;
            height: 600px;
            float: left;
        }

        .div2 {
            width: 300px;
            height: 600px;
            float: left;
            margin-left: 100px;
        }
        .div3 {
            float: left;
        }
        .div4 {
            height: 110px;
            padding-top: 20px;
            /*border: 1px solid black;*/
        }
        .div5 {
            float: left;
            margin-left: 50px;
        }

        .div6 {
            float: right;
            color: #dfdede;
            margin-top: 30px;
        }
        .hr {
            color: #dfdede;
        }
        .myhr {
            color: #dfdede;
            margin-top: 47px;
        }
        .img{
            border-radius: 45px;
        }
    </style>
</head>

<body>
    <div id="app" class="mydiv">
        <div class="div1">
            <div>
                <h2>课程互动</h2>
            </div>
            <div>
                <coursereviews></coursereviews>
            </div>
        </div>
        <div class="div2">
            <h2>学生动态</h2>
            <hr class="myhr">
        </div>
    </div>
    <template id="coursereviewstpl">
        <div>
            <reviewitem v-for="review in reviews" 
            :headimg="review.headimg" 
            :coursename="review.coursename"
            :detail="review.detail" 
            :time="review.time"></reviewitem>
        </div>
    </template>
    <template id="reviewitemtpl">
        <div class="div4">
            <div>
                <hr class="hr">
            </div>
            <div class="div3">
                <img :src="headimg" alt="" width="90px" height="90px" class=img>
            </div>
            <div class="div5">
                <span>评论课程：</span><br>
                <span style="color: red;">{{coursename}}</span><br>
                <span>{{detail}}</span>
            </div>
            <div class="div6">
                {{time}}
            </div>
        </div>
    </template>
</body>

</html>
<script>
    var vm = new Vue({
        el: '#app',
        components: {
            'coursereviews': {
                template: '#coursereviewstpl',
                data: function () {
                    return {
                        reviews: [
                            { headimg: "../images/model1.png", coursename: "《java基础1》", detail: "支持1，不错！", time: "2020-11-25 21:21" },
                            { headimg: "../images/model2.jpg", coursename: "《java基础2》", detail: "支持2，不错！", time: "2020-11-25 21:21" },
                            { headimg: "../images/model4.jpg", coursename: "《java基础3》", detail: "支持3，不错！", time: "2020-11-25 21:21" },
                            { headimg: "../images/model5.jpg", coursename: "《java基础4》", detail: "支持4，不错！", time: "2020-11-25 21:21" }
                        ]
                    }
                },
                components: {
                    'reviewitem': {
                        template: '#reviewitemtpl',
                        props: ["headimg", "coursename", "detail", "time"]
                    }
                }
            }
        }
    });
</script>